//
//  YQTransferDetailCell.m
//  NewRetail
//
//  Created by yuqin on 2019/6/26.
//  Copyright © 2019 yuqin. All rights reserved.
//

#import "YQTransferDetailCell.h"

@interface YQTransferDetailCell ()

@end

@implementation YQTransferDetailCell


- (void)setupTableViewCellView {
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    [self addSubview:self.theTitleLab];//标题
    [self addSubview:self.lineView];//分割线
    [self addSubview:self.addressTF];//1.3行的输入框
    [self addSubview:self.addressLab];// 2的文字显示
    [self addSubview:self.collectionListBtn];//1行的两个按钮
    [self addSubview:self.scanningBtn];
    [self addSubview:self.coinsNameLab];//3行的币种
    [self addSubview:self.rightBtn];
    [self addSubview:self.coinsNumsLab];
    
    [self.theTitleLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMargin_left);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(FIT(100), FIT(20)));
    }];
    [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(kMargin_left);
        make.right.mas_equalTo(-kMargin_right);
        make.bottom.mas_equalTo(-1);
        make.height.mas_equalTo(1);
    }];
    [self.addressTF mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.theTitleLab.mas_right).mas_equalTo(FIT(0));
        make.right.mas_equalTo(-FIT(66));
        make.centerY.mas_equalTo(self.mas_centerY);
        make.height.mas_equalTo(FIT(20));
    }];
    [self.addressLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.theTitleLab.mas_right).mas_equalTo(0);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.right.mas_equalTo(-kMargin_right);
        make.height.mas_equalTo(FIT(20));
    }];
    
    [self.collectionListBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.mas_centerY);
        make.right.mas_equalTo(-kMargin_right);
        make.size.mas_equalTo(CGSizeMake(FIT(15), FIT(15)));
    }];
    
    [self.scanningBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.mas_centerY);
        make.right.equalTo(self.collectionListBtn.mas_left).mas_equalTo(-FIT(15));
        make.size.mas_equalTo(CGSizeMake(FIT(15), FIT(15)));
    }];
    [self.coinsNameLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-kMargin_right);
        make.centerY.mas_equalTo(self.mas_centerY);
        make.size.mas_equalTo(CGSizeMake(FIT(60), FIT(20)));
    }];
    
    [self.rightBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(-kMargin_right);
        make.centerY.mas_equalTo(self.mas_centerY);
    }];
//
    [self.coinsNumsLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.theTitleLab.mas_right).mas_equalTo(0); make.right.equalTo(self.rightBtn.mas_left).mas_equalTo(-FIT(10));
        make.centerY.mas_equalTo(self.mas_centerY);
        make.height.mas_equalTo(FIT(20));
    }];
    
}

#pragma mark - 创建
- (UILabel *)theTitleLab {
    if (!_theTitleLab) {
        _theTitleLab = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentLeft fontSize:kCellFont userBold:NO];
    }
    return _theTitleLab;
}

- (UIView *)lineView {
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = LineColor;
    }
    return _lineView;
}

- (UITextField *)addressTF {
    //默认隐藏
    if (!_addressTF) {
        _addressTF = [YQViewFactory textFieldWithPlaceholderText:@"扫码或输入" textColor:[UIColor lightGrayColor] fontSize:kCellFont userBold:NO];
        _addressTF.textAlignment = NSTextAlignmentRight;
        _addressTF.hidden = YES;
    }
    return _addressTF;
}

- (UILabel *)addressLab {
    if (!_addressLab) {
        _addressLab = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentCenter fontSize:FIT(13) userBold:NO];
        _addressLab.hidden = YES;
        _addressLab.text = @"0x635ewkjsd09357sdfuw23shf";
    }
    return _addressLab;
}

//第三行d最后的label
- (UILabel *)coinsNameLab {
    if (!_coinsNameLab) {
        _coinsNameLab = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentRight fontSize:kCellFont userBold:NO];
        _coinsNameLab.text = @"WDC";
        _coinsNameLab.hidden = YES;
    }
    return _coinsNameLab;
}

//第四行的文字
- (UILabel *)coinsNumsLab {
    if (!_coinsNumsLab) {
        _coinsNumsLab = [YQViewFactory labelWithTextColor:MainBlackColor textAlignment:NSTextAlignmentRight fontSize:FIT(13) userBold:NO];
        _coinsNumsLab.text = @"3875.23478 WDC可转";
        _coinsNumsLab.hidden = YES;
    }
    return  _coinsNumsLab;
}

- (UIButton *)scanningBtn {
    if (!_scanningBtn) {
        _scanningBtn = [YQViewFactory buttonWithImage:YQ_IMAGE(@"scanning") target:self sel:@selector(scanningAction)];
        _scanningBtn.hidden = YES;
        [_scanningBtn setEnlargeEdgeWithTop:5 right:5 bottom:5 left:5];
    }
    return _scanningBtn;
}

- (UIButton *)collectionListBtn {
    if (!_collectionListBtn) {
        _collectionListBtn = [YQViewFactory buttonWithImage:YQ_IMAGE(@"address_list") target:self sel:@selector(showListAction)];
        _collectionListBtn.hidden = YES;
        [_collectionListBtn setEnlargeEdgeWithTop:5 right:5 bottom:5 left:5];
    }
    return _collectionListBtn;
}

- (UIButton *)rightBtn {
    if (!_rightBtn) {
        _rightBtn = [YQViewFactory buttonWithTitle:@"全部转出" titleColor:MainBlueColor fontSize:FIT(13) userBold:NO target:self sel:@selector(transferAll)];
        _rightBtn.hidden = YES;
    }
    return _rightBtn;
}

//点击扫描
- (void)scanningAction {
    if (self.ScanningBlock) {
        self.ScanningBlock();
    }
}

//点击书的图标
- (void)showListAction {
    
}

//全部转出(显示在第五个cell上)
- (void)transferAll {
    
}

@end
